<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>设置我的资料</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>

<body>


<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">设置我的资料</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-row">
                        <div class="layui-col-md2"
                             style="display: flex;justify-content: flex-end;">
                            <img class="layui-header"
                                 src=""/>
                        </div>
                        <div class="layui-col-md10">
                            <form action="/uploadAvatar.do"
                                  method="post"
                                  enctype="multipart/form-data">
                                <div class="layui-form" lay-filter="">
                                    <input type="hidden"  name="id" value="${userInfo.id}"/>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">用户名</label>
                                        <div class="layui-input-inline">
                                            <input type="text"
                                                   name="username"
                                                   value="${userInfo.account}"
                                                   readonly
                                                   class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">
                                            不可修改,用于后台登录名
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">昵称</label>
                                        <div class="layui-input-inline">
                                            <input type="text"
                                                   name="nickname"
                                                   value="${userInfo.name}"
                                                   lay-verify="nickname"
                                                   autocomplete="off"
                                                   placeholder="请输入昵称"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">性别</label>
                                        <div class="layui-input-block">
                                            <input type="radio"
                                                   name="sex"
                                                   value="0"
                                                   title="男"
                                                   ${userInfo.gender==0?'checked':''}
                                                   />
                                            <input type="radio"
                                                   name="sex"
                                                   value="1"
                                                   title="女"
                                            ${userInfo.gender==1?'checked':''}
                                            />
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">头像</label>
                                        <%--										<div class="layui-input-inline">--%>
                                        <%--											<input name="avatar"--%>
                                        <%--												   lay-verify="required"--%>
                                        <%--												   id="LAY_avatarSrc"--%>
                                        <%--												   placeholder="图片地址"--%>
                                        <%--												   value=""--%>
                                        <%--												   class="layui-input">--%>
                                        <%--										</div>--%>
                                        <div class="layui-input-inline"
                                             style="width: auto;">
                                            <input type="file"
                                                   class="layui-btn layui-btn-primary"
                                                   name="avatar" value="${userInfo.avatar}" >
                                            </input>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">手机</label>
                                        <div class="layui-input-inline">
                                            <input type="text"
                                                   name="cellphone"
                                                   value="${userInfo.phone}"
                                                   lay-verify=""
                                                   autocomplete="off"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">邮箱</label>
                                        <div class="layui-input-inline">
                                            <input type="text"
                                                   name="email"
                                                   value="${userInfo.email}"
                                                   lay-verify=""
                                                   autocomplete="off"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">备注</label>
                                        <div class="layui-input-block">
										<textarea name="remarks"
                                                  placeholder="请输入内容"
                                                  class="layui-textarea">${userInfo.remarks}</textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <input type="submit"
                                                   class="layui-btn"
                                                   value="确认修改"
                                                   lay-filter="setmyinfo" lay-submit/>


                                            <button type="reset"
                                                    class="layui-btn layui-btn-primary">
                                                重新填写
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script language="JavaScript" src="./layui/layui.all.js"></script>
<script>
    layui.use(['layer','form',"jquery"], function () {
        var form=layui.form,
            layer=layui.layer,
            $=layui.$;
        form.render();

        form.on('submit(setmyinfo)', function (data) {
            console.log(data.field)
        })

        <%--$("#head", parent.document).attr('src',--%>
        <%--    '${sessionScope.user.header}');--%>
        <%--$("#reader", parent.document).html(--%>
        <%--    '${sessionScope.user.reader}');--%>

        //执行实例
        // var uploadInst = upload.render({
        //     elem: '#LAY_avatarUpload' //绑定元素
        //     , url: '/uploadAvatar.do' //上传接口
        //     , done: function (res) {
        //         //上传完毕回调
        //     }
        //     , error: function () {
        //         //请求异常回调
        //     }
        // });


        //各种基于事件的操作，下面会有进一步介绍
    });
</script>
</body>

</html>